<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>


    <!-- Meta -->
    <meta name="description" content="Premium Quality and Responsive UI for Dashboard."/>
    <meta name="author" content="ThemePixels"/>

    <link rel="shortcut icon" th:href="@{/picture/favicon.ico}" type="image/x-icon"/>
    <title>茅台·天津 | 活动登记系统</title>

    <!-- vendor css -->
    <link th:href="@{/css/font-awesome.css}" rel="stylesheet"/>
    <link th:href="@{/css/ionicons.css}" rel="stylesheet"/>
    <link th:href="@{/css/perfect-scrollbar.css}" rel="stylesheet"/>
    <link th:href="@{/css/github.css}" rel="stylesheet"/>
    <link th:href="@{/css/jquery.datatables.css}" rel="stylesheet"/>
    <link th:href="@{/css/select2.min.css}" rel="stylesheet"/>

    <!-- Starlight CSS -->
    <link rel="stylesheet" th:href="@{/css/starlight.css}"/>
</head>

<body>

<!-- ########## START: LEFT PANEL ########## -->
<div class="sl-logo"><a href=""><img th:src="@{/picture/mt_logo_wh.jpg}" style="width: 30px; height: 30px;"/> <span
        style="font-size: 18px">茅台·活动登记系统</span></a></div>
<div class="sl-sideleft">

    <label class="sidebar-label">导航栏</label>
    <div class="sl-sideleft-menu">
        <a th:href="@{/activity/list}" class="sl-menu-link">
            <div class="sl-menu-item">
                <i class="menu-item-icon icon ion-ios-paper-outline tx-20"></i>
                <span class="menu-item-label">活动项列表</span>
            </div><!-- menu-item -->
        </a><!-- sl-menu-link -->
        <a th:href="@{/activityForm}" th:if="${user.isManagement eq 2}" class="sl-menu-link">
            <div class="sl-menu-item">
                <i class="menu-item-icon icon ion-ios-paper-outline tx-20"></i>
                <span class="menu-item-label">新增活动项目</span>
            </div><!-- menu-item -->
        </a><!-- sl-menu-link -->
        <a th:href="@{/saleRecordForm}" class="sl-menu-link">
            <div class="sl-menu-item">
                <i class="menu-item-icon icon ion-ios-photos-outline tx-20"></i>
                <span class="menu-item-label">新增销售记录</span>
            </div><!-- menu-item -->
        </a><!-- sl-menu-link -->
        <a href="#" class="sl-menu-link active show-sub" th:if="${user.isManagement} eq 2 or ${user.isManagement} eq 1">
            <div class="sl-menu-item">
                <i class="menu-item-icon icon ion-ios-gear-outline tx-24"></i>
                <span class="menu-item-label">用户管理</span>
                <i class="menu-item-arrow fa fa-angle-down"></i>
            </div><!-- menu-item -->
        </a><!-- sl-menu-link -->
        <ul class="sl-menu-sub nav flex-column" th:if="${user.isManagement} eq 2 or ${user.isManagement} eq 1">
            <li class="nav-item"><a th:href="@{/user/initUser}" class="nav-link">添加用户</a></li>
            <li class="nav-item"><a th:href="@{/user/list}" class="nav-link active">用户列表</a></li>
        </ul>
        <a href="" class="sl-menu-link">
            <div class="sl-menu-item">
                <i class="menu-item-icon icon ion-ios-bookmarks-outline tx-20"></i>
                <span class="menu-item-label">关于</span>
            </div><!-- menu-item -->
        </a><!-- sl-menu-link -->
    </div><!-- sl-sideleft-menu -->

</div><!-- sl-sideleft -->
<!-- ########## END: LEFT PANEL ########## -->

<!-- ########## START: HEAD PANEL ########## -->
<div class="sl-header">
    <div class="sl-header-left">
        <div class="navicon-left hidden-md-down"><a id="btnLeftMenu" href=""><i class="icon ion-navicon-round"></i></a></div>
        <div class="navicon-left hidden-lg-up"><a id="btnLeftMenuMobile" href=""><i class="icon ion-navicon-round"></i></a></div>
    </div><!-- sl-header-left -->
    <div class="sl-header-right">
        <nav class="nav">
            <div class="dropdown">
                <a href="" class="nav-link nav-link-profile" data-toggle="dropdown">
                    <span class="logged-name" th:text="${user.companyShortName} + ' | ' + ${user.name}">海津皇冠 | 皇冠</span>
                    <img th:src="@{/picture/mt_logo_wh.jpg}" class="wd-32 rounded-circle" alt=""/>
                </a>
                <div class="dropdown-menu dropdown-menu-header wd-200">
                    <ul class="list-unstyled user-profile-nav">
                        <li><a href=""><i class="icon ion-ios-person-outline"></i> Edit Profile</a></li>
                        <li><a href=""><i class="icon ion-ios-gear-outline"></i> Settings</a></li>
                        <li><a href=""><i class="icon ion-ios-download-outline"></i> Downloads</a></li>
                        <li><a href=""><i class="icon ion-ios-star-outline"></i> Favorites</a></li>
                        <li><a href=""><i class="icon ion-ios-folder-outline"></i> Collections</a></li>
                        <li><a th:href="@{/logout}"><i class="icon ion-power"></i> Sign Out</a></li>
                    </ul>
                </div><!-- dropdown-menu -->
            </div><!-- dropdown -->
        </nav>
        <div class="navicon-right">

        </div><!-- navicon-right -->
    </div><!-- sl-header-right -->
</div><!-- sl-header -->
<!-- ########## END: HEAD PANEL ########## -->

<!-- ########## START: RIGHT PANEL ########## -->

<!-- ########## END: RIGHT PANEL ########## -->

<!-- ########## START: MAIN PANEL ########## -->
<div class="sl-mainpanel">
    <nav class="breadcrumb sl-breadcrumb">
        <a class="breadcrumb-item" th:href="@{/activity/list}">茅台销售登记系统</a>
        <a class="breadcrumb-item" th:href="@{/user/List}">用户列表</a>
        <span class="breadcrumb-item active">用户列表</span>
    </nav>

    <div class="sl-pagebody">

        <div class="card pd-20 pd-sm-40">
            <h6 class="card-body-title">用户列表</h6>
            <p class="mg-b-20 mg-sm-b-30">The list of user's information.</p>
            <form th:action="@{/user/list}" method="get">
                <div class="row">
                    <div class="col-lg-8 mg-b-10">
                        <div class="input-group">
                            <input type="text" class="form-control clo-sm-6 col-md-4" name="keywords"
                                   placeholder="按单位名称搜索..." th:value="${keywords}"/>
                            <input type="hidden" id="type"/>
                            <span class="input-group-btn mg-r-20">
                                <button class="btn bd bg-white tx-gray-600" type="submit"><i class="fa fa-search"></i>
                                </button>
                            </span>
                            <a class="btn btn-info active btn-block col-lg-3" th:href="@{/user/initUser}" th:if="${user.isManagement eq 2}">新增管理员用户</a>
                            <a class="btn btn-info active btn-block col-lg-3" th:href="@{/user/initUser}" th:if="${user.isManagement eq 1}">新增普通用户</a>
                        </div><!-- input-group -->

                    </div><!-- col-4 -->
                </div><!-- row -->
            </form>

            <div class="table-responsive">
                <table class="table table-hover table-bordered mg-b-0">
                    <thead class="bg-info">
                    <tr>
                        <th class="wd-25p" style="text-align: center">用户姓名</th>
                        <th class="wd-10p" style="text-align: center">性别</th>
                        <th class="wd-10p" style="text-align: center">联系方式</th>
                        <th class="wd-10p" style="text-align: center">所属公司</th>
                        <th class="wd-10p" style="text-align: center">身份权限</th>
                        <th class="wd-10p" style="text-align: center">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="user: ${list}">
                        <td style="text-align: center"><a th:href="@{/customerList}" th:text="${user.name}"></a></td>
                        <td style="text-align: center">
                            <span th:if="${user.isManagement} ne 1 and ${user.isManagement} ne 2" th:text="${(user.sex eq 1 and user.sex ne 2) ? '男' : '女'}"/>
                            <span th:unless="${user.isManagement} ne 1 and ${user.isManagement} ne 2" th:text="'/'"/>
                        </td>
                        <td style="text-align: center"><span th:text="${user.mobilePhone}"></span></td>
                        <td style="text-align: center"><span th:text="${user.companyShortName}"></span></td>
                        <td style="text-align: center"><span th:if="${user.isManagement eq 1}">管理员</span>
                            <span th:if="${user.isManagement eq 0}">普通用户</span></td>
                        <td style="text-align: center">
                            <a href="#">修改</a>&nbsp;&nbsp;<a href="#">删除</a>
                        </td><!-- th:href="@{/user/{id}(id=${user.id})}" -->
                    </tr>
                    </tbody>
                </table>
            </div><!-- table-responsive -->

            <!--页码 start-->
            <div class="ht-80 bd d-flex align-items-center justify-content-center">
                <nav aria-label="Page navigation">
                    <ul class="pagination pagination-basic mg-b-0">

                        <li th:class="${page.pageNo eq 1} ? 'page-item' : 'page-item'">
                            <a class="page-link" aria-label="First" th:if="${page.pageNo eq 1}" href="#">
                                <i class="fa fa-angle-double-left"></i>
                            </a>
                            <a class="page-link" aria-label="First" th:if="${page.pageNo ne 1} and ${page.pageNo lt 10}" th:href="@{/user/list(keywords=${keywords}, pageNo=1)}">
                                <i class="fa fa-angle-double-left"></i>
                            </a>
                            <a class="page-link" aria-label="First" th:if="${page.pageNo gt 10}" th:href="@{/user/list(keywords=${keywords}, pageNo=${page.pageNo} - 10)}">
                                <i class="fa fa-angle-double-left"></i>
                            </a>
                        </li>

                        <li th:class="${page.pageNo eq 1} ? 'page-item' : 'page-item'">
                            <a class="page-link" aria-label="previous" th:if="${page.pageNo eq 1}" href="#">
                                <i class="fa fa-angle-left"></i>
                            </a>
                            <a class="page-link" aria-label="previous" th:unless="${page.pageNo eq 1}" th:href="@{/user/list(keywords=${keywords}, pageNo=${page.pageNo} - 1)}">
                                <i class="fa fa-angle-left"></i>
                            </a>
                        </li>

                        <li th:if="${page.pageTotal eq 0}" class="page-item active"><a class="page-link" href="#">1</a></li>
                        <li th:if="${page.pageTotal ne 0} and ${page.pageTotal le 10}" th:each="currentPage : ${#numbers.sequence(1, page.pageTotal)}" th:class="${currentPage eq page.pageNo} ? 'page-item active' : 'page-item'">
                            <a th:if="${page.pageNo eq currentPage}" class="page-link" href="#" th:text="${currentPage}"/>
                            <a th:if="${page.pageNo ne currentPage} and ${currentPage ne 0}" class="page-link" th:href="@{/user/list(keywords=${keywords}, pageNo=${currentPage})}" th:text="${currentPage}"/>
                        </li>
                        <li th:if="${page.pageTotal ne 0} and ${page.pageTotal gt 10} and ${page.pageNo le 10}" th:each="currentPage : ${#numbers.sequence(1, 10)}" th:class="${currentPage eq page.pageNo} ? 'page-item active' : 'page-item'">
                            <a th:if="${page.pageNo eq currentPage}" class="page-link" href="#" th:text="${currentPage}"/>
                            <a th:if="${page.pageNo ne currentPage} and ${currentPage le 10}" class="page-link" th:href="@{/user/list(keywords=${keywords}, pageNo=${currentPage})}" th:text="${currentPage}"/>
                        </li>
                        <li th:if="${page.pageTotal ne 0} and ${page.pageTotal gt 10} and ${page.pageNo gt 10} and ${(page.pageTotal - page.pageNo) ge 10}" th:each="currentPage : ${#numbers.sequence(page.pageNo - 4, page.pageNo + 5)}" th:class="${currentPage eq page.pageNo} ? 'page-item active' : 'page-item'">
                            <a th:if="${page.pageNo eq currentPage}" class="page-link" href="#" th:text="${currentPage}"/>
                            <a th:if="${page.pageNo ne currentPage} and ${(page.pageNo - currentPage) lt 5} and ${(page.pageNo - currentPage) ge -5}" class="page-link" th:href="@{/user/list(keywords=${keywords}, pageNo=${currentPage})}" th:text="${currentPage}"/>
                        </li>
                        <li th:if="${page.pageTotal ne 0} and ${page.pageTotal gt 10} and ${page.pageNo gt 10} and ${(page.pageTotal - page.pageNo) lt 10}" th:each="currentPage : ${#numbers.sequence(page.pageNo - 4, (page.pageNo + 5) lt page.pageTotal ? page.pageNo + 5 : page.pageTotal)}" th:class="${currentPage eq page.pageNo} ? 'page-item active' : 'page-item'">
                            <a th:if="${page.pageNo eq currentPage}" class="page-link" href="#" th:text="${currentPage}"/>
                            <a th:if="${page.pageNo ne currentPage} and ${(page.pageNo - currentPage) le 5} and ${(page.pageNo - currentPage) ge -5}" class="page-link" th:href="@{/user/list(keywords=${keywords}, pageNo=${currentPage})}" th:text="${currentPage}"/>
                        </li>

                        <li class="page-item">
                            <a class="page-link" aria-label="Next" th:if="${page.pageNo eq page.pageTotal}" href="#">
                                <i class="fa fa-angle-right"></i>
                            </a>
                            <a class="page-link" aria-label="Next" th:if="${page.pageTotal eq 0}" href="#">
                                <i class="fa fa-angle-right"></i>
                            </a>
                            <a class="page-link" aria-label="Next" th:if="${page.pageNo lt page.pageTotal}" th:href="@{/user/list(keywords=${keywords}, pageNo=${page.pageNo} + 1)}">
                                <i class="fa fa-angle-right"></i>
                            </a>
                        </li>

                        <li class="page-item">
                            <a class="page-link" aria-label="Last" th:if="${page.pageNo eq page.pageTotal}" href="#">
                                <i class="fa fa-angle-double-right"></i>
                            </a>
                            <a class="page-link" aria-label="Last" th:if="${page.pageNo ne page.pageTotal} and ${page.pageTotal ge (page.pageNo+10)}" th:href="@{/user/list(keywords=${keywords}, pageNo=${page.pageNo} + 10)}">
                                <i class="fa fa-angle-double-right"></i>
                            </a>
                            <a class="page-link" aria-label="Last" th:if="${page.pageNo ne page.pageTotal} and ${page.pageTotal lt (page.pageNo+10)}" th:href="@{/user/list(keywords=${keywords}, pageNo=${page.pageTotal})}">
                                <i class="fa fa-angle-double-right"></i>
                            </a>
                        </li>

                    </ul>
                </nav>
            </div>
            <!--页码 end-->
        </div><!-- card -->

    </div><!-- sl-pagebody -->
    <footer class="sl-footer">
        <div class="footer-left">
            <div class="mg-b-2">Copyright &copy; 2018. 天津海津皇冠贸易有限公司. All Rights Reserved.</div>
        </div>
        <div class="footer-right d-flex align-items-center">Made by 海津皇冠.</div>
    </footer>
</div><!-- sl-mainpanel -->
<!-- ########## END: MAIN PANEL ########## -->

<script th:src="@{/js/jquery.js}"></script>
<script th:src="@{/js/popper.js}"></script>
<script th:src="@{/js/bootstrap.js}"></script>
<script th:src="@{/js/perfect-scrollbar.jquery.js}"></script>
<script th:src="@{/js/highlight.pack.js}"></script>
<script th:src="@{/js/jquery.datatables.js}"></script>
<script th:src="@{/js/datatables.responsive.js}"></script>
<script th:src="@{/js/select2.min.js}"></script>

<script th:src="@{/js/starlight.js}"></script>
<script>
    $(function(){
        'use strict';

        $('#datatable1').DataTable({
            responsive: true,
            bLengthChange: false,
            language: {
                searchPlaceholder: '输入关键字搜索...',
                sSearch: '',
                // lengthMenu: '_MENU_ items/page',
            }
        });

        // Select2
        $('.dataTables_length select').select2({ minimumResultsForSearch: Infinity });

    });
</script>

</body>
</html>
